package entities;

import util.DataVerify;

public class User 
{
	private String userID;
	private String email;
	private String name;
	private String lname;
	private String password;
	/**
	 * @param user_name
	 * @param email
	 * @param name
	 * @param lname
	 * @param password
	 */
	public User(String user_name, String email, String name, String lname,
			String password) {
		this.userID = user_name;
		this.email = email;
		this.name = name;
		this.lname = lname;
		this.password = password;
	}
	/**
	 * 
	 */
	public User() {
		// TODO Auto-generated constructor stub
	}
	/**
	 * @return the user_name
	 */
	public String getUserID() {
		return userID;
	}
	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @return the lname
	 */
	public String getLname() {
		return lname;
	}
	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}
	/**
	 * @param user_name the user_name to set
	 */
	public void setUserID(String user_name) {
		this.userID = user_name;
	}
	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @param lname the lname to set
	 */
	public void setLname(String lname) {
		this.lname = lname;
	}
	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}
	public static User newInstance(String user_name, String email, String name, String lname,
			String password){
		DataVerify.verifyObject("username",user_name);
		DataVerify.verifyObject("name",name);
		DataVerify.verifyObject("lastname",lname);
		DataVerify.verifyObject("email",email);
		DataVerify.verifyObject("upassword",password);	
		return new User(user_name, name, lname, email,password);
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		User other = (User) obj;
		if (email == null) {
			if (other.email != null)
				return false;
		} else if (!email.equals(other.email))
			return false;
		if (lname == null) {
			if (other.lname != null)
				return false;
		} else if (!lname.equals(other.lname))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (password == null) {
			if (other.password != null)
				return false;
		} else if (!password.equals(other.password))
			return false;
		if (userID == null) {
			if (other.userID != null)
				return false;
		} else if (!userID.equals(other.userID))
			return false;
		return true;
	}
}
